package wpwork.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Data
@TableName("ksh_group_table")
public class KshGroupEntity {

    @TableId(value = "f_id", type = IdType.AUTO)
    private Long id;

    @TableField("f_name")
    private String name;

    @TableField("f_code")
    private String code;

    @TableField("f_parent_id")
    private Long parentId;

    @TableField("f_level")
    private Integer level;

    @TableField("f_path")
    private String path;

    @TableField("f_description")
    private String description;

    @TableField("f_sort_order")
    private Integer sortOrder;

    @TableField("f_created_by")
    private String createdBy;

    @TableField("f_created_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdTime;

    @TableField("f_updated_by")
    private String updatedBy;

    @TableField("f_updated_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedTime;

    @TableField("f_deleted")
    private Boolean deleted;

    // 非数据库字段
    @TableField(exist = false)
    private List<KshGroupEntity> children = new ArrayList<>();

    @TableField(exist = false)
    private String parentName;
}